package evil.wolf.db;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConnectDatabase {

	Connection conn;
	DatabaseConfig dbConfig = new DatabaseConfig();
	
	public ConnectDatabase() {
		getConnection();
	}
	
	Connection getConnection(){
		try {
				Class.forName("oracle.jdbc.driver.OracleDriver");
			} catch (ClassNotFoundException e) {
				e.printStackTrace();
			}
		
		try {
			conn = DriverManager.getConnection(dbConfig.getUrl() + dbConfig.getServerName() + ":"
					+ dbConfig.getPort() + "/" + dbConfig.getDatabaseName(),
					dbConfig.getUserName(), dbConfig.getPassword());
			
		} catch (SQLException e) {
			System.out.println("Could not initialize the database.");
			e.printStackTrace();
		}
		return conn;
	}
}